﻿using Ec_System.Facade.Web;
using Ec_System.Models.Web;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Ec_System.WebUI.Areas.Web.Controllers
{
    public class ShopProductController : Controller
    {
        // GET: Web/ShopProduct
        /// <summary>
        /// 商品信息首页--根据商品ID打开其详细页面
        /// </summary>
        /// <param name="productID"></param>
        /// <returns></returns>
        public ActionResult ProductInfo(int productID)
        {
            ViewBag.ID = productID;
            return View();
        }

        /// <summary>
        /// 获取商品的评论数据
        /// </summary>
        /// <param name="productID"></param>
        /// <param name="pageSize"></param>
        /// <param name="pageIndex"></param>
        /// <returns></returns>
        [HttpPost]
        public JsonResult GetEvaluationList(int productID, int pageSize, int pageIndex)
        {
            EvaluationFacade evaluationFacade = new EvaluationFacade();
            var model = evaluationFacade.GetEvaluationByProductID(productID, pageIndex, pageSize);

            return Json(model, JsonRequestBehavior.AllowGet);
        }
    }
}